#include "SmMessage.h"

#include "SmErrorCode.h"
namespace base {
namespace SM {

void SmMessage::Message::PushNumberData(int32_t num)
{
    numberData_.push_back(num);
}

SmErrorCode SmMessage::Message::PopNumberDate(int32_t &num)
{
    if (numberData_.empty()) {
        // log("number data list empty.");
        return SmErrorCode::SM_GET_NUMBER_DATA_FAILED;
    }

    num = numberData_.front();
    numberData_.pop_front();
    return SmErrorCode::SM_SUCCESS;
}

void SmMessage::Message::PushStringData(const std::string str)
{
    stringData_.push_back(str);
}

SmErrorCode SmMessage::Message::PopStringData(std::string &str)
{
    if (stringData_.empty()) {
        // log("string data list empty.");
        return SmErrorCode::SM_GET_STRING_DATA_FAILED;
    }

    str = stringData_.front();
    stringData_.pop_front();
    return SmErrorCode::SM_SUCCESS;
}

void SmMessage::Message::clearData()
{
    numberData_.clear();
    stringData_.clear();
}

SmMessage::SmMessage()
{}

SmMessage::~SmMessage()
{}

} // namespace SM

} // namespace base